import React from 'react';
import { createStore, applyMiddleware } from 'redux';
import { BrowserRouter } from 'react-router-dom';
import { Provider } from 'react-redux';
import createSagaMiddleware from 'redux-saga';
import ReactDOM from 'react-dom/client';
import storeReducer from './store/reducers/index';
import homeRootSaga from './sagas/homeSaga';
import Routers from './routers/index.js';
import App from './App';


const sagaMiddle = createSagaMiddleware()

const store = createStore(storeReducer, applyMiddleware(sagaMiddle));

sagaMiddle.run(homeRootSaga)


const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <Provider store={store}>
    <React.StrictMode>
      <App />
      <BrowserRouter>
        <Routers />
      </BrowserRouter>
    </React.StrictMode>
  </Provider>
);
